<?php
declare(strict_types=1);
namespace SixShop\Lakala\Model;

use SixShop\Lakala\Enum\ProfitShareOrderCMDTypeEnum;
use SixShop\Lakala\Enum\ProfitShareOrderStatusEnum;
use SixShop\Lakala\Enum\ReceiverStatusEnum;
use SixShop\Payment\Enum\NumberBizEnum;
use think\Model;

class ProfitShareOrderModel extends Model
{
    protected function getOptions(): array
    {
        return [
            'name' => 'profit_share_order',
            'type' => [
                'status' => ProfitShareOrderStatusEnum::class,
                'cmd_type' => ProfitShareOrderCMDTypeEnum::class,
            ],
            'insert' => ['out_separate_no'],
            'readonly' => ['user_id', 'out_separate_no'],
        ];
    }
    public function getStatusTextAttr($value, $data)
    {
        return $data['status']->toString();
    }
    protected function setOutSeparateNoAttr($value, $data): string
    {
        return generate_number(NumberBizEnum::PROFIT_SHARE_ORDER, 5);
    }
}